package com.wjm.notification;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;

import com.wjm.notification.service.UploadIntentService;
import com.wjm.notification.service.UploadService;

public class MainActivity extends AppCompatActivity {

    private Button btn_upload;
    private Button btn_pause;
    private Button btn_carry_on;
    private Button btn_cancel;
    private ProgressBar pb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById();
    }

    private void findViewById() {
        btn_upload = (Button) findViewById(R.id.btn_upload);
        btn_pause = (Button) findViewById(R.id.btn_pause);
        btn_carry_on = (Button) findViewById(R.id.btn_carry_on);
        btn_cancel = (Button) findViewById(R.id.btn_cancel);
        pb = (ProgressBar) findViewById(R.id.pb);

        btn_upload.setOnClickListener(new View.OnClickListener() {//开始上传
            @Override
            public void onClick(View view) {
//                Intent intent = new Intent(MainActivity.this, UploadIntentService.class);
//                intent.setAction(UploadIntentService.ACTION);
//                intent.putExtra(UploadIntentService.EXTRA_KEY, UploadIntentService.startUpload);
//                startService(intent);

                Intent intent = new Intent(MainActivity.this, UploadService.class);
                intent.setAction(UploadService.ACTION);
                intent.putExtra(UploadService.EXTRA_KEY, UploadService.startUpload);
                startService(intent);
            }
        });
        btn_pause.setOnClickListener(new View.OnClickListener() {//暂停
            @Override
            public void onClick(View view) {

            }
        });
        btn_carry_on.setOnClickListener(new View.OnClickListener() {//继续
            @Override
            public void onClick(View view) {

            }
        });
        btn_cancel.setOnClickListener(new View.OnClickListener() {//取消
            @Override
            public void onClick(View view) {

            }
        });
    }
}
